package com.spzx.product.api.factory;

import com.spzx.common.core.domain.R;
import com.spzx.product.api.domain.Brand;
import com.spzx.product.api.service.RemoteBrandService;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class RemoteBrandFallbackFactory implements FallbackFactory<RemoteBrandService> {

    @Override
    public RemoteBrandService create(Throwable cause) {
        return new RemoteBrandService() {
            @Override
            public R<List<Brand>> getAllBrand(String source) {
                return R.fail("获取全部品牌失败:" + cause.getMessage());
            }

        };
    }
}
